package com.slofzx.nuoda.evaluation.project.enums;

import com.slofzx.nuoda.common.EnumConfig;
import com.slofzx.nuoda.common.config.Type;
@EnumConfig(
        id = "gas-product-property",
        name = "气品质"
)
public enum  GasProductPropertyEnum implements Type {
    DRY_GAS("dry_gas", "干气",1),
    WET_GAS("wet_gas", "湿气",2),


            ;

    /**
     * 标识
     */
    private String id;
    /**
     * 名称
     */
    private String name;
    /**
     * 排序值
     */
    private double sort;

    GasProductPropertyEnum(String id, String name, double sort) {
        this.id = id;
        this.name = name;
        this.sort = sort;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    /**
     * 根据标识获取枚举值
     * @param id
     * @return
     */
    public static GasProductPropertyEnum getEnum(String id) {
        for(GasProductPropertyEnum item:values()) {
            if (item.getId().equals(id)) {
                return item;
            }
        }
        return null;
    }

    public static GasProductPropertyEnum getEnumByName(String name) {
        for(GasProductPropertyEnum item: GasProductPropertyEnum.values()) {
            if (item.getName().equals(name)) {
                return item;
            }
        }
        return null;
    }

}
